﻿<UserControl x:Class="MetaTracker.View.UserSettingsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Loaded="UserSettingsView_Loaded"
             Unloaded="UserSettingsView_Unloaded"
             d:DesignHeight="379" d:DesignWidth="685">
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
        <TextBlock Margin="20"/>
        <TextBlock Text="Attach to your services:" HorizontalAlignment="Center"
                               FontWeight="DemiBold"/>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="AUTO"/>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0" Margin="5" >
                <Hyperlink NavigateUri="http://my.withings.com" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                    Withings: 
                </Hyperlink>
            </TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="1" Margin="5" >
                <Hyperlink NavigateUri="http://www.fatsecret.com" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                    Fat Secret:
                </Hyperlink>
            </TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="2" Margin="5" >
                <Hyperlink NavigateUri="http://www.fitbit.com" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                    Fitbit:
                </Hyperlink>
            </TextBlock>
            <TextBlock Grid.Column="1" Grid.Row="0" Margin="5" 
                                   Text="{Binding HasWithings, Converter={StaticResource BoolToConnected}}" />
            <TextBlock Grid.Column="1" Grid.Row="1" Margin="5" 
                                   Text="{Binding HasFatSecret, Converter={StaticResource BoolToConnected}}" />
            <TextBlock Grid.Column="1" Grid.Row="2" Margin="5" 
                                   Text="{Binding HasFitbit, Converter={StaticResource BoolToConnected}}" />
            <Button Grid.Column="2" Grid.Row="0" Margin="5" 
                                Content="{Binding HasWithings, Converter={StaticResource BoolToRegister}}"
                                Command="{Binding RegisterWithingsCommand}"/>
            <Button Grid.Column="2" Grid.Row="1" Margin="5" 
                                Content="{Binding HasFatSecret, Converter={StaticResource BoolToRegister}}" 
                                Command="{Binding RegisterFatSecretCommand}"/>
            <Button Grid.Column="2" Grid.Row="2" Margin="5" 
                    Content="{Binding HasFitbit, Converter={StaticResource BoolToRegister}}"
                    Command="{Binding RegisterFitbitCommand}"/>
            <!--Content="{Binding HasFitbit, Converter={StaticResource BoolToRegister}}"-->
            
            
        </Grid>

        <TextBlock Text="Pick a service for each of the following:" Margin="0,15,0,0" 
                               HorizontalAlignment="Center" FontWeight="DemiBold"/>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" 
                                HorizontalAlignment="Center">
            <StackPanel Orientation="Vertical" Margin="10,5,10,5">
                <TextBlock Text="Weigh Tracking:" FontWeight="DemiBold"/>
                <RadioButton Content="None" Height="16" GroupName="a"
                                IsChecked="{Binding WeightService, Converter={StaticResource RadioConverter}, ConverterParameter=0 }"/>
                <RadioButton Content="Withings" Height="16"
                                IsEnabled="{Binding HasWithings}" GroupName="b"
                                IsChecked="{Binding WeightService, Converter={StaticResource RadioConverter}, ConverterParameter=1 }"/>
                <RadioButton Content="FatSecret" Height="16"
                                IsEnabled="{Binding HasFatSecret}" GroupName="c"
                                IsChecked="{Binding WeightService, Converter={StaticResource RadioConverter}, ConverterParameter=2 }"/>
                <RadioButton Content="Fitbit" Height="16"
                                IsEnabled="{Binding HasFitbit}" GroupName="d"
                                IsChecked="{Binding WeightService, Converter={StaticResource RadioConverter}, ConverterParameter=3 }"/>

            </StackPanel>
            <StackPanel Orientation="Vertical" Margin="10,5,10,5">
                <TextBlock Text="Food Tracking:" FontWeight="DemiBold"/>
                <RadioButton Content="None" Height="16" GroupName="e"
                                 IsChecked="{Binding FoodIntakeService, Converter={StaticResource RadioConverter}, ConverterParameter=0 }"/>
                <RadioButton Content="FatSecret" Height="16" GroupName="f"
                                 IsEnabled="{Binding HasFatSecret}"
                                 IsChecked="{Binding FoodIntakeService, Converter={StaticResource RadioConverter}, ConverterParameter=2 }"/>
                <RadioButton Content="Fitbit" Height="16" GroupName="g"
                                 IsEnabled="{Binding HasFitbit}"
                                 IsChecked="{Binding FoodIntakeService, Converter={StaticResource RadioConverter}, ConverterParameter=3 }"/>
            </StackPanel>
            <StackPanel Orientation="Vertical" Margin="10,5,10,5">
                <TextBlock Text="Exercise Tracking:" FontWeight="DemiBold"/>
                <RadioButton Content="None" Height="16" GroupName="h"
                                 IsChecked="{Binding ExerciseService, Converter={StaticResource RadioConverter}, ConverterParameter=0, 
                                Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                <RadioButton Content="FatSecret" Height="16" GroupName="j"
                                 IsEnabled="{Binding HasFatSecret}"
                                 IsChecked="{Binding ExerciseService, Converter={StaticResource RadioConverter}, ConverterParameter=2,  
                                 Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                <RadioButton Content="Fitbit" Height="16" GroupName="i"
                                 IsEnabled="{Binding HasFitbit}"
                                 IsChecked="{Binding ExerciseService, Converter={StaticResource RadioConverter}, ConverterParameter=3,  
                                 Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </StackPanel>
        </StackPanel>
        <TextBlock Margin="30" HorizontalAlignment="Center">           
            <Hyperlink NavigateUri="http://platform.fatsecret.com" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                Powered by FatSecret
            </Hyperlink>
        </TextBlock>
    </StackPanel>
</UserControl>
